#include<stdio.h>
//#include<sys/types.h>
//#include<stdlib.h>
//#include<unistd.h>
//
int g_val = 100;
int main()
{
  pid_t id = fork();
  if(!id)
  {
    int count = 0;
    while(1)
    {
      printf("child, pid:%d   ppid:%d  g_val:%d  &g_val:%p\n", getpid(), getppid(), g_val, &g_val);
      sleep(1);
      count++;
      if(count == 5)
      {
        g_val = 200;
        printf("chage sccess\n");
      }
    }
  }
  else 
  {
    while(1)
    {
      printf("parent, pud:%d   ppid:%d  g_val:%d  &g_val:%p\n", getpid(), getppid(), g_val, &g_val);
      sleep(1);
    }
  }
  return 0;
}
